# -*- coding: utf-8 -*-
import re
from bs4 import BeautifulSoup
from urllib.request import urlopen

url = "http://www.heibanke.com/lesson/crawler_ex00/"
digit = ''
loops = 0


while True:
    html = urlopen(url+digit, timeout=10).read()
    bs_obj = BeautifulSoup(html.decode(), 'lxml')
    text = bs_obj.h3.text
    number = re.search('\d+', text)
    if number:
        digit = number.group()
        print(digit)
    else:
        break

print(bs_obj.h3.text)
